﻿using System;
using System.Net;

namespace Hydra.Shell.ProjectionAttributes
{
    [AttributeUsage(AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    public sealed class DataContractAttribute : Attribute
    {
        private bool isNameSetExplicit;
        private bool isNamespaceSetExplicit;
        private bool isReference;
        private bool isReferenceSetExplicit;
        private string name;
        private string ns;
        private Type implementInterfaceType;

        public DataContractAttribute()
        {

        }

        public DataContractAttribute(Type implementInterfaceType)
        {
            this.implementInterfaceType = implementInterfaceType;
        }

        internal bool IsNameSetExplicit
        {
            get
            {
                return this.isNameSetExplicit;
            }
        }

        internal bool IsNamespaceSetExplicit
        {
            get
            {
                return this.isNamespaceSetExplicit;
            }
        }

        public bool IsReference
        {
            get
            {
                return this.isReference;
            }
            set
            {
                this.isReference = value;
                this.isReferenceSetExplicit = true;
            }
        }

        internal bool IsReferenceSetExplicit
        {
            get
            {
                return this.isReferenceSetExplicit;
            }
        }

        public Type InterfaceType
        {
            get
            {
                return implementInterfaceType;
            }

            set
            {
                implementInterfaceType = value;
            }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
                this.isNameSetExplicit = true;
            }
        }

        public string Namespace
        {
            get
            {
                return this.ns;
            }
            set
            {
                this.ns = value;
                this.isNamespaceSetExplicit = true;
            }
        }
    }
}
